package reduce.fz.com.reduce.fragment;


import android.os.Bundle;
import android.app.Fragment;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import reduce.fz.com.reduce.R;
import reduce.fz.com.reduce.adapter.WitnessCardAdapter;
import reduce.fz.com.reduce.bean.result.UserWitness;
import reduce.fz.com.reduce.custom.JazzyViewPager;
import reduce.fz.com.reduce.fragment.base.BaseFragment;

/**
 * 见证首页
 */
public class WitnessFragment extends BaseFragment {
    //横滑的viewPager
    private JazzyViewPager mJazzy;
    //小组内待见证列表
    private List<UserWitness> userWitnessList;
    private LayoutInflater layoutInflater;
    private WitnessCardAdapter.WitnessCardListener cardListener;
    public WitnessFragment() {
    }

    public static WitnessFragment create(Long teamid)
    {
        Bundle bundle=new Bundle();
        bundle.putLong("teamid",teamid);
        WitnessFragment fragment=new WitnessFragment();
        fragment.setArguments(bundle);
        return fragment;
    }

    public void initCardListener()
    {
        cardListener=new WitnessCardAdapter.WitnessCardListener() {
            @Override
            public void onMainImageClick() {

            }

            @Override
            public void onWitnessPass() {

            }

            @Override
            public void onWitnessNoPass() {

            }

            @Override
            public void loadMore() {

            }
        };
    }



    private void setupJazziness(JazzyViewPager.TransitionEffect effect,View view) {
        mJazzy = (JazzyViewPager) view.findViewById(R.id.jazzy_pager);
        mJazzy.setTransitionEffect(effect);
        mJazzy.setAdapter(new WitnessCardAdapter(userWitnessList,cardListener));
        mJazzy.setPageMargin(30);
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view= inflater.inflate(R.layout.fragment_witness, container, false);
        setupJazziness(JazzyViewPager.TransitionEffect.Tablet,view);
        return view;
    }

    @Override
    public void onStart() {
        super.onStart();
        layoutInflater=getActivity().getLayoutInflater();

    }




}
